import os
from public.public_variable import curent_time


def writer_log(text):
    pub_path = os.path.dirname(__file__)
    proj_path = os.path.dirname(pub_path)
    now_time = curent_time
    fail_path = proj_path + '/Logs/'+f'{now_time}.log'
    # 如果打开的文件不存在他会给我们创建出来
    with open(file=fail_path,mode='a',encoding='utf-8') as  f:
        f.write(curent_time + ":" + text + '\n')
    # 格式要对应，写就用w或者a，不能用r；r读,w覆盖写入，a追加
